﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace SP_XHWeb.WebParts.CompanyFund
{
    public partial class CompanyFundUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string listUrl = Request.Url.ToString();
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(listUrl))
                {
                    using (SPSite site = new SPSite(listUrl))
                    {
                        using (SPWeb web = site.OpenWeb())
                        {
                            SPList spList = web.Lists["CompanyFund"];

                            if (spList != null && spList.ItemCount > 0)
                            {
                                SPListItem item = spList.Items[0];
                                lblTitle.InnerHtml = item.Title;
                                lblDesc.InnerHtml = item["Description"].ToString();

                            }
                            else
                            {
                                lblDesc.InnerHtml = "暂无内容...";
                            }
                        }
                    }
                }
                else
                {
                    lblDesc.InnerHtml = "暂无内容...";
                }
            }
        }
    }
}
